<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge，chrome=1">

    <title>文档修改</title>

    <link rel="stylesheet" href="/static/css-lib/bootstrap.min.css" />
    <link rel="stylesheet" href="/static/css-cus/summernote.css" />
</head>
<body>
    <!-- 头部区域 -->
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">文档修改</a>
            </div>
            <div style="position: absolute;top: 10px;right: 30px;">
                <button data-id="<c:out value="${Doc.id}"/>" id="sub-btn" type="button" class="btn btn-primary">提交</button>
            </div>
        </div>
    </nav>

    <!-- 内容区域 -->
    <div class="container-fluid" style="margin-top: 55px;">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
                <div class="input-group">
                    <span class="input-group-addon">文档标题</span>
                    <input id="title" type="text" class="form-control" placeholder="1~100个字符" value="<c:out value="${Doc.title}"/>">
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
                <div class="input-group">
                    <span class="input-group-addon">适用角色</span>
                    <div class="input-box">
                        <select id="role" class="form-control">
                            <option value="0" <c:if test="${Doc.role == 0}">selected</c:if> >公共</option>
                            <option value="1" <c:if test="${Doc.role == 1}">selected</c:if> >老师</option>
                            <option value="2" <c:if test="${Doc.role == 2}">selected</c:if> >家长</option>
                            <option value="3" <c:if test="${Doc.role == 3}">selected</c:if> >学生</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
                <div class="input-group">
                    <span class="input-group-addon">排序</span>
                    <input id="order" type="number" class="form-control" placeholder="数字越低，级别越高" value="<c:out value="${Doc.order}"/>">
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
                <div class="input-group">
                    <span class="input-group-addon">是否启用</span>
                    <div class="input-box">
                        <select id="enable" class="form-control">
                            <option value="1" <c:if test="${Doc.isEnable == 1}">selected</c:if> >是</option>
                            <option value="0" <c:if test="${Doc.isEnable == 0}">selected</c:if> >否</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <br/>

        <div class="row">
            <div id="edit-area"><c:out value="${Doc.content}" escapeXml="false"/></div>
        </div>
    </div>

    <!-- 错误提示框 -->
    <div id="error-box" class="modal fade" tabindex="-1" role="dialog" data-backdrop="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">错误</h4>
                </div>
                <div id="error-content" class="modal-body"></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 警告框 -->
    <div id="alert-box" class="modal fade" tabindex="-1" role="dialog" data-backdrop="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">警告</h4>
                </div>
                <div class="modal-body">您尚未选择启用这个文档，不启用将对用户不可见，确定提交吗？</div>
                <div class="modal-footer">
                    <button id="cancel" type="button" class="btn btn-default" data-dismiss="modal">返回修改</button>
                    <button id="confirm" type="button" class="btn btn-primary">提交</button>
                </div>
            </div>
        </div>
    </div>

    <script src="/static/js-lib/jquery-3.4.1.min.js"></script>
    <script src="/static/js-lib/bootstrap.min.js"></script>
    <script src="/static/js-lib/summernote.min.js"></script>
    <script src="/static/js-cus/admin/Frame-DocUpdate.js"></script>
</body>
</html>